import requests



import requests
from entity.Stocks import Stocks


def getGoodsData():
    goodsList = []
    url = 'https://hq.sinajs.cn/list=sh000001,sh000688,s_sz399300,s_sz399905,s_sh000016,s_sz399006'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36'
    }
    resp = requests.get(url=url, headers=headers)
    respList = resp.text.split(";")

    if len(respList) >= 6:
        goodsList.append(respList[0].replace("\n", "").split(",")[3])
        goodsList.append(respList[2].replace("\n", "").split(",")[1])
        goodsList.append(respList[3].replace("\n", "").split(",")[1])
        goodsList.append(respList[4].replace("\n", "").split(",")[1])
        goodsList.append(respList[5].replace("\n", "").split(",")[1])
        goodsList.append(respList[1].replace("\n", "").split(",")[3])


    stocks = Stocks(goodsList[0], goodsList[1], goodsList[2], goodsList[3], goodsList[4], goodsList[5])
    return stocks

import util.DbUtil as db
from util.DbUtil import SqlUtils
#
# data = getGoodsData()
#
# sql = SqlUtils()
# sql.insert(db.TABLE_STOCKS, data.__dict__)
# print(data.__dict__)

import datetime

print(datetime.datetime.now().weekday())